package face.pay.common.enterprise.service.impl;

import face.pay.common.enterprise.service.IWxInfoService;
import face.pay.dao.EnterpriseInfoDao;
import face.pay.entity.EnterpriseInfo;
import face.pay.util.ResultMessage;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Auther: cjj
 * @Date: 2019/9/24
 * @Description:
 */
@Service
@Slf4j
public class WxInfoService implements IWxInfoService {

    @Autowired
    private EnterpriseInfoDao enterpriseInfoDao;

    /**
     * @param enterpriseInfo
     * @return
     */
    @Override
    public ResultMessage editWxInfo(EnterpriseInfo enterpriseInfo) {
        try {
            this.enterpriseInfoDao.update(enterpriseInfo);
        } catch (Exception e) {
            e.printStackTrace();
            log.info("商家微信支付资料更新失败" + enterpriseInfo.getWxSubMchId());
            return ResultMessage.createFail("微信支付信息更新失败,稍后重试!");
        }
        return ResultMessage.createSuccess();
    }
}
